from pymemcache.client.base import Client

cache = Client(('127.0.0.1',11211), )

def set(key,value,timeout=60):
    return cache.set(key,value,timeout)

def get(key):
    return cache.get(key)

def delete(key):
    return cache.delete(key)

# def json_serializer(key, value):
#     if type(value)==str:
#         return value, 1
#     else:
#         return json.dump(value), 2
#
# def json_deserizlizer(key, value, flags):
#     if flags==1:
#         return value
#     elif flags == 2:
#         return json.loads(value)
#         raiseException("Unknown serialization format")

